import Vue from "vue";
import VueRouter from "vue-router";
// 新的首页
import Home from "../views/Home.vue";
import NewHome from "../views/NewHome.vue";
import Search from "../views/Search.vue";
import PostDetails from "../views/PostDetails.vue";
import MoreContent from "../views/MoreContent.vue";
import Column from "../views/Column.vue";

import Register from "../views/Register.vue";
import Login from "../views/Login.vue";

import Collect from "../views/personal/Collect.vue";
import PersonalIndex from "../views/personal/Index.vue";
import Edit from "../views/personal/Edit.vue";
import Follows from "../views/personal/Follows.vue";
import MyComment from "../views/personal/Mycomment.vue";

// 测试组件
import Test from "../views/text.vue";
// 注册插件
Vue.use(VueRouter);

const routes = [
  // 首页
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  // 首页2
  {
    path: "/newhome",
    name: "NewHome",
    component: NewHome,
  },
  {
    path: "/search",
    name: "searchPage",
    component: Search,
  },
  {
    path: "/postdetails",
    name: "postDetailsPage",
    component: PostDetails,
  },
  {
    path: "/column",
    name: "columnPage",
    component: Column,
  },
  {
    path: "/morecontent",
    name: "moreContentPage",
    component: MoreContent,
  },
  {
    path: "/collect",
    name: "collectPage",
    component: Collect,
    meta: {
      needAuth: true,
    },
  },
  // 注册页
  {
    path: "/register",
    name: "registerPage",
    component: Register,
  },
  // 登录页
  {
    path: "/login",
    name: "loginPage",
    component: Login,
  },
  {
    path: "/personal",
    name: "personalPage",
    component: PersonalIndex,
    meta: {
      needAuth: true,
    },
  },
  {
    path: "/edit",
    name: "EditPage",
    component: Edit,
    meta: {
      needAuth: true,
    },
  },
  {
    path: "/follows",
    name: "FollowsPage",
    component: Follows,
    meta: {
      needAuth: true,
    },
  },
  {
    path: "/comment",
    name: "commentPage",
    component: MyComment,
    meta: {
      needAuth: true,
    },
  },
  {
    path: "/test",
    component: Test,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
